package pregnancyImport;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Table;
import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableIterator;
import org.apache.poi.hwpf.usermodel.TableRow;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.util.StringUtils;
import org.testng.annotations.Test;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisConnectionException;

import com.aliyun.openservices.shade.com.alibaba.rocketmq.shade.com.alibaba.fastjson.JSON;
import com.bbcare.comm.AppException;
import com.bbcare.comm.Constants;
import com.bbcare.comm.DateUtil;
import com.bbcare.comm.ErrorCode;
import com.bbcare.comm.SeqUtil;
import com.bbcare.followup.plat.entity.FuAssessMentPosition;
import com.bbcare.followup.plat.store.ibatis.IFollowEvaluationDAO;

@ContextConfiguration(locations = { "classpath*:/ibatis-config.xml",
		"classpath*:/spring-mvc.xml","classpath*:/spring-mybatis.xml"
		})
//高危孕产妇评价题目导入
public class ImportParturient extends AbstractTestNGSpringContextTests{
	@Resource(name = "jedisPool")
	private JedisPool jedisPool;

	@Autowired
	private IFollowEvaluationDAO followEvaluationDao;

	public static void main(String [] args) throws Exception{
		//new ImportParturient().saveQuestion(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\高危儿孕产妇评估问卷.doc"),Constants.FOLLOW_EVALUATION_HIGH_PREGNANT,true,"高危产妇","一般情况");
//		new ImportParturient().saveSelfRating(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\焦虑自评量表.doc.doc"),Constants.FOLLOW_EVALUATION_HIGH_PREGNANT,true,"SAS","一般情况");
	}

	@Test
	public void test() throws Exception{
//		saveQuestion(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\高危儿孕产妇评估问卷.doc"),Constants.FOLLOW_EVALUATION_HIGH_PREGNANT,true,"高危产妇","一般情况");
//		saveSelfRating(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\焦虑自评量表.doc"),Constants.FOLLOW_EVALUATION_PREGNANT_SAS,true,"SAS","一般情况");
//		saveSelfRating(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\自评抑郁量表.doc"),Constants.FOLLOW_EVALUATION_PREGNANT_SDS,true,"SDS","一般情况");
//		saveEpds(new File("F:\\bbcare\\交接文档\\资料\\高危儿孕产妇\\爱丁堡产后抑郁量表.doc"),Constants.FOLLOW_EVALUATION_PREGNANT_EPDS,true,"EPDS","一般情况");
	//	saveSDQ(new File("F:\\bbcare\\交接文档\\资料\\SDQ问卷\\SDQ_导入格式.doc"),Constants.FOLLOW_EVALUATION_PREGNANT_SDQ,true,"SDQ","一般情况");
//		saveALberta(new File("F:\\bbcare\\交接文档\\资料\\ALberta运动量表\\Alberta表2003.doc"),Constants.FOLLOW_EVALUATION_PREGNANT_AIMS,true,"AIMS","一般情况");
	}

	//ALberta
	public  void saveALberta(File file, String examinationPaperName, boolean isOrder, String headTag, String noHeadTag)
			throws Exception {
		// TODO Auto-generated method stub

//			Map<String, String> postion = new HashMap<String, String>();
		Map<String, List<Map<String,Object>>> postion = new LinkedHashMap<String, List<Map<String,Object>>>();
		String examinationPaperKey = examinationPaperName;	//试卷唯一标志
		Jedis jedis = jedisPool.getResource();
		FileInputStream in = new FileInputStream(file.getAbsoluteFile());// 载入文档
		POIFSFileSystem pfs = new POIFSFileSystem(in);
		HWPFDocument hwpf = new HWPFDocument(pfs);
		Range range = hwpf.getRange();// 得到文档的读取范围
		TableIterator it = new TableIterator(range);
		// 迭代文档中的表格
		while (it.hasNext()) {
			Table tb = (Table) it.next();
			// 迭代行，默认从0开始
			List<Map<String,Object>> list =  null;
			for (int i = 0; i < tb.numRows(); i++) {
				TableRow tr = tb.getRow(i);
				// 迭代列，默认从0开始
				String numHead ="";
				Map<String,Object> map = new HashMap<String,Object>();
				for (int j = 0; j < tr.numCells(); j++) {
					TableCell td = tr.getCell(j);// 取得单元格
					// 取得单元格的内容
					boolean flag =false; //第一行过滤
					for (int k = 0; k < td.numParagraphs(); k++) {
						Paragraph para = td.getParagraph(k);
						String s = para.text();
						if(para.text().contains("")) s = para.text().substring(0, para.text().indexOf(""));
						if(s.startsWith(headTag)) { //第一行过滤
							flag = true;
							break;
						}
						/*if(s.equals(noHeadTag)){
							numHead = s;
						}
						*/
						if(j==0 && !StringUtils.isEmpty(s)){ //第一列 并且 该单元格不为空
							numHead = s;
							list = new ArrayList<Map<String,Object>>();
							postion.put(numHead,list);
						}

						if(j==1){
							map.put("id",s);
						}
						if(j==2){
							map.put("name",s);
						}
						if(j==3){
							map.put("desc",s);
						}
						if(j==4){
							map.put("score",s);
							list.add(map);
						}

					} // end for
					if(flag){
						break;
					}
				} // end for
			} // end for
		} // end while
		try{
			jedis.select(Constants.REDIS_DB_INDEX_EVALUATION);
			jedis.hset(Constants.FOLLOW_EVALUATION_PREGNANT_KEY,examinationPaperKey,JSON.toJSONString(postion));

			FuAssessMentPosition positionPt = new FuAssessMentPosition();
			positionPt.setId(SeqUtil.getSeqNo());
			positionPt.setCreateAuthor("admin");
			positionPt.setField(Constants.FOLLOW_EVALUATION_PREGNANT_KEY);
			positionPt.setValue(JSON.toJSONString(postion));
			positionPt.setKey(examinationPaperKey);
			positionPt.setCreateTime(DateUtil.getSysDateA());
			positionPt.setType(examinationPaperKey);
			followEvaluationDao.saveAssessMentPosition(positionPt);
		}catch (JedisConnectionException jex) {
            logger.error("redis连接异常..." + jex.getMessage());
            throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_ERROR, "Redis缓存连接失败!"));
        } finally {
            if (null != jedis) {
                try {
                    jedis.close();
                    logger.warn("close redis connection...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                    throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_CLOSE_FAILED,
                            "Redis缓存关闭失败!"));
                }
            }
        }
		System.out.println(JSON.parseObject(JSON.toJSONString(postion),LinkedHashMap.class));
		in.close();
	}

	//高危产妇评价
	public  void saveQuestion(File file, String examinationPaperName, boolean isOrder, String headTag, String noHeadTag)
			throws Exception {
		// TODO Auto-generated method stub

//		Map<String, String> postion = new HashMap<String, String>();
		Map<String, List<Map<String,Object>>> postion = new LinkedHashMap<String, List<Map<String,Object>>>();
		String examinationPaperKey = examinationPaperName;	//试卷唯一标志
		Jedis jedis = jedisPool.getResource();
		FileInputStream in = new FileInputStream(file.getAbsoluteFile());// 载入文档
		POIFSFileSystem pfs = new POIFSFileSystem(in);
		HWPFDocument hwpf = new HWPFDocument(pfs);
		Range range = hwpf.getRange();// 得到文档的读取范围
		TableIterator it = new TableIterator(range);
		// 迭代文档中的表格
		while (it.hasNext()) {
			Table tb = (Table) it.next();
			// 迭代行，默认从0开始
			List<Map<String,Object>> list =  null;
			for (int i = 0; i < tb.numRows(); i++) {
				TableRow tr = tb.getRow(i);
				// 迭代列，默认从0开始
				String numHead ="";
				Map<String,Object> map = new HashMap<String,Object>();
				for (int j = 0; j < tr.numCells(); j++) {
					TableCell td = tr.getCell(j);// 取得单元格
					// 取得单元格的内容
					boolean flag =false; //第一行过滤
					for (int k = 0; k < td.numParagraphs(); k++) {
						Paragraph para = td.getParagraph(k);
						String s = para.text();
						if(para.text().contains("")) s = para.text().substring(0, para.text().indexOf(""));
						if(s.startsWith(headTag)) { //第一行过滤
							flag = true;
							break;
						}
						/*if(s.equals(noHeadTag)){
							numHead = s;
						}
						*/
						if(j==0 && !StringUtils.isEmpty(s)){ //第一列 并且 该单元格不为空
							numHead = s;
							list = new ArrayList<Map<String,Object>>();
							postion.put(numHead,list);
						}

						if(j==1){
							map.put("id",s);
						}
						if(j==2){
							map.put("name",s);
						}
						if(j==3){
							map.put("score",s);
							list.add(map);
						}

					} // end for
					if(flag){
						break;
					}
				} // end for
			} // end for
		} // end while
		try{
			jedis.select(Constants.REDIS_DB_INDEX_EVALUATION);
			jedis.hset(Constants.FOLLOW_EVALUATION_PREGNANT_KEY,examinationPaperKey,JSON.toJSONString(postion));

			FuAssessMentPosition positionPt = new FuAssessMentPosition();
			positionPt.setId(SeqUtil.getSeqNo());
			positionPt.setCreateAuthor("admin");
			positionPt.setField(Constants.FOLLOW_EVALUATION_PREGNANT_KEY);
			positionPt.setValue(JSON.toJSONString(postion));
			positionPt.setKey(examinationPaperKey);
			positionPt.setCreateTime(DateUtil.getSysDateA());
			positionPt.setType(examinationPaperKey);
			followEvaluationDao.saveAssessMentPosition(positionPt);
		}catch (JedisConnectionException jex) {
            logger.error("redis连接异常..." + jex.getMessage());
            throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_ERROR, "Redis缓存连接失败!"));
        } finally {
            if (null != jedis) {
                try {
                    jedis.close();
                    logger.warn("close redis connection...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                    throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_CLOSE_FAILED,
                            "Redis缓存关闭失败!"));
                }
            }
        }
		System.out.println(JSON.parseObject(JSON.toJSONString(postion),LinkedHashMap.class));
		in.close();
	}

	//焦虑、抑郁自评表
	public  void saveSelfRating(File file, String examinationPaperName, boolean isOrder, String headTag, String noHeadTag)
			throws Exception {
		// TODO Auto-generated method stub

//			Map<String, String> postion = new HashMap<String, String>();

		List<Map<String,Object>> postionlist = new ArrayList<Map<String,Object>>();
		String examinationPaperKey = examinationPaperName;	//试卷唯一标志
		Jedis jedis = jedisPool.getResource();
		FileInputStream in = new FileInputStream(file.getAbsoluteFile());// 载入文档
		POIFSFileSystem pfs = new POIFSFileSystem(in);
		HWPFDocument hwpf = new HWPFDocument(pfs);
		Range range = hwpf.getRange();// 得到文档的读取范围
		TableIterator it = new TableIterator(range);
		// 迭代文档中的表格
		while (it.hasNext()) {
			Table tb = (Table) it.next();
			// 迭代行，默认从0开始
			List<Map<String,Object>> list =  null;
			for (int i = 0; i < tb.numRows(); i++) {
				TableRow tr = tb.getRow(i);
				// 迭代列，默认从0开始
				String numHead ="";
				Map<String,Object> map = new LinkedHashMap<String, Object>();
				List<Map<String,Object>> answerList = null;
				for (int j = 0; j < tr.numCells(); j++) {
					TableCell td = tr.getCell(j);// 取得单元格
					// 取得单元格的内容
					boolean flag =false; //第一行过滤
					for (int k = 0; k < td.numParagraphs(); k++) {
						Paragraph para = td.getParagraph(k);
						String s = para.text();
						if(para.text().contains("")) s = para.text().substring(0, para.text().indexOf(""));
						if(s.startsWith("SAS") || s.startsWith("SDS")) { //第一行过滤
							flag = true;
							break;
						}
						/*if(s.equals(noHeadTag)){
							numHead = s;
						}
						*/
						if(j==0){ //第一列 并且 该单元格不为空
							map.put("id",s);
							answerList = new ArrayList<Map<String,Object>>();
							map.put("answer", answerList);
						}

						if(j==1){
							map.put("name",s);
						}
						if(j==2){
							Map<String,Object> tempMap = new LinkedHashMap<String, Object>();
							tempMap.put("id",1);
							tempMap.put("name","没有或很少时间有");
							tempMap.put("score",s);
							answerList.add(tempMap);
						}
						if(j==3){
							Map<String,Object> tempMap = new LinkedHashMap<String, Object>();
							tempMap.put("id",2);
							tempMap.put("name","少部分时间");
							tempMap.put("score",s);
							answerList.add(tempMap);
						}
						if(j==4){
							Map<String,Object> tempMap = new LinkedHashMap<String, Object>();
							tempMap.put("id",3);
							tempMap.put("name","相当多时间");
							tempMap.put("score",s);
							answerList.add(tempMap);
						}
						if(j==5){
							Map<String,Object> tempMap = new LinkedHashMap<String, Object>();
							tempMap.put("id",4);
							tempMap.put("name","绝大部分或全部时间");
							tempMap.put("score",s);
							answerList.add(tempMap);

							map.put("answer",answerList);
							postionlist.add(map);
						}

					} // end for
					if(flag){
						break;
					}
				} // end for
			} // end for
		} // end while
		try{
			jedis.select(Constants.REDIS_DB_INDEX_EVALUATION);
			jedis.hset(Constants.FOLLOW_EVALUATION_PREGNANT_KEY,examinationPaperKey,JSON.toJSONString(postionlist));
			FuAssessMentPosition position = new FuAssessMentPosition();
			position.setId(SeqUtil.getSeqNo());
			position.setCreateAuthor("admin");
			position.setField(Constants.FOLLOW_EVALUATION_PREGNANT_KEY);
			position.setValue(JSON.toJSONString(postionlist));
			position.setKey(examinationPaperKey);
			position.setCreateTime(DateUtil.getSysDateA());
			position.setType(examinationPaperKey);
			followEvaluationDao.saveAssessMentPosition(position);
		}catch (JedisConnectionException jex) {
            logger.error("redis连接异常..." + jex.getMessage());
            throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_ERROR, "Redis缓存连接失败!"));
        } finally {
            if (null != jedis) {
                try {
                    jedis.close();
                    logger.warn("close redis connection...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                    throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_CLOSE_FAILED,
                            "Redis缓存关闭失败!"));
                }
            }
        }
//		System.out.println(JSON.parseObject(JSON.toJSONString(postionlist),LinkedHashMap.class));
		System.out.println(JSON.toJSONString(postionlist));
		in.close();
	}

	//爱丁堡产后
	public  void saveEpds(File file, String examinationPaperName, boolean isOrder, String headTag, String noHeadTag)
			throws Exception {
		// TODO Auto-generated method stub

//				Map<String, String> postion = new HashMap<String, String>();

		List<Map<String,Object>> postionlist = new ArrayList<Map<String,Object>>();
		String examinationPaperKey = examinationPaperName;	//试卷唯一标志
		Jedis jedis = jedisPool.getResource();
		FileInputStream in = new FileInputStream(file.getAbsoluteFile());// 载入文档
		POIFSFileSystem pfs = new POIFSFileSystem(in);
		HWPFDocument hwpf = new HWPFDocument(pfs);
		Range range = hwpf.getRange();// 得到文档的读取范围
		TableIterator it = new TableIterator(range);
		// 迭代文档中的表格
		while (it.hasNext()) {
			Table tb = (Table) it.next();
			// 迭代行，默认从0开始
			List<Map<String,Object>> list =  null;
			for (int i = 0; i < tb.numRows(); i++) {
				TableRow tr = tb.getRow(i);
				// 迭代列，默认从0开始
				String numHead ="";
				Map<String,Object> map = new LinkedHashMap<String, Object>();

				Map<String,Object> mapQ = null;
				List<Map<String,Object>> answerList = null;
				for (int j = 0; j < tr.numCells(); j++) {
					TableCell td = tr.getCell(j);// 取得单元格
					// 取得单元格的内容
					boolean flag =false; //第一行过滤
					for (int k = 0; k < td.numParagraphs(); k++) {
						Paragraph para = td.getParagraph(k);
						String s = para.text();
						if(para.text().contains("")) s = para.text().substring(0, para.text().indexOf(""));
						if(s.startsWith(headTag)) { //第一行过滤
							flag = true;
							break;
						}
						/*if(s.equals(noHeadTag)){
							numHead = s;
						}
						*/
						if(j==0 && !StringUtils.isEmpty(s)){ //第一列 并且 该单元格不为空
							numHead = s;
							list = new ArrayList<Map<String,Object>>();
							mapQ = new LinkedHashMap<String, Object>();
							mapQ.put("name",numHead);
							mapQ.put("id",postionlist.size()+1);
							mapQ.put("answer",list);
							postionlist.add(mapQ);
						}

						if(j==1){
							map.put("id",s);
						}
						if(j==2){
							map.put("name",s);
						}
						if(j==3){
							map.put("score",s);
							list.add(map);
						}

					} // end for
					if(flag){
						break;
					}
				} // end for
			} // end for
		} // end while
		try{
			jedis.select(Constants.REDIS_DB_INDEX_EVALUATION);
			jedis.hset(Constants.FOLLOW_EVALUATION_PREGNANT_KEY,examinationPaperKey,JSON.toJSONString(postionlist));

			FuAssessMentPosition position = new FuAssessMentPosition();
			position.setId(SeqUtil.getSeqNo());
			position.setCreateAuthor("admin");
			position.setField(Constants.FOLLOW_EVALUATION_PREGNANT_KEY);
			position.setValue(JSON.toJSONString(postionlist));
			position.setKey(examinationPaperKey);
			position.setCreateTime(DateUtil.getSysDateA());
			position.setType(examinationPaperKey);
			followEvaluationDao.saveAssessMentPosition(position);
		}catch (JedisConnectionException jex) {
            logger.error("redis连接异常..." + jex.getMessage());
            throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_ERROR, "Redis缓存连接失败!"));
        } finally {
            if (null != jedis) {
                try {
                    jedis.close();
                    logger.warn("close redis connection...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                    throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_CLOSE_FAILED,
                            "Redis缓存关闭失败!"));
                }
            }
        }
//			System.out.println(JSON.parseObject(JSON.toJSONString(postionlist),LinkedHashMap.class));
		System.out.println(JSON.toJSONString(postionlist));
		in.close();
	}

	//SDQ
	public  void saveSDQ(File file, String examinationPaperName, boolean isOrder, String headTag, String noHeadTag)
			throws Exception {
		// TODO Auto-generated method stub
		List<Map<String,Object>> postionlist = new ArrayList<Map<String,Object>>();
		String examinationPaperKey = examinationPaperName;	//试卷唯一标志
		Jedis jedis = jedisPool.getResource();
		FileInputStream in = new FileInputStream(file.getAbsoluteFile());// 载入文档
		POIFSFileSystem pfs = new POIFSFileSystem(in);
		HWPFDocument hwpf = new HWPFDocument(pfs);
		Range range = hwpf.getRange();// 得到文档的读取范围
		TableIterator it = new TableIterator(range);
		// 迭代文档中的表格
		while (it.hasNext()) {
			Table tb = (Table) it.next();
			// 迭代行，默认从0开始
			List<Map<String,Object>> list =  null;
			for (int i = 0; i < tb.numRows(); i++) {
				TableRow tr = tb.getRow(i);
				// 迭代列，默认从0开始
				String numHead ="";
				Map<String,Object> map = new LinkedHashMap<String, Object>();

				Map<String,Object> mapQ = null;
				List<Map<String,Object>> answerList = null;
				for (int j = 0; j < tr.numCells(); j++) {
					TableCell td = tr.getCell(j);// 取得单元格
					// 取得单元格的内容
					boolean flag =false; //第一行过滤
					for (int k = 0; k < td.numParagraphs(); k++) {
						Paragraph para = td.getParagraph(k);
						String s = para.text();
						if(para.text().contains("")) s = para.text().substring(0, para.text().indexOf(""));
						if(s.startsWith(headTag)) { //第一行过滤
							flag = true;
							break;
						}
						/*if(s.equals(noHeadTag)){
							numHead = s;
						}
						*/
						if(j==0 && !StringUtils.isEmpty(s)){ //第一列 并且该单元格不为空
							numHead = s;
							list = new ArrayList<Map<String,Object>>();
							mapQ = new LinkedHashMap<String, Object>();
							if(s.split("-").length==2){
								if("亲社会行为".equals(s.split("-")[1])){
									mapQ.put("factor",Constants.SDQ_FACTOR_TYPE_PROSOCIAL);
								}else if("多动".equals(s.split("-")[1])){
									mapQ.put("factor",Constants.SDQ_FACTOR_TYPE_MBD);
								}else if("情绪症状".equals(s.split("-")[1])){
									mapQ.put("factor",Constants.SDQ_FACTOR_TYPE_EMOTIONAL);
								}else if("品行问题".equals(s.split("-")[1])){
									mapQ.put("factor",Constants.SDQ_FACTOR_TYPE_CONDUCT);
								}else if("同伴交往".equals(s.split("-")[1])){
									mapQ.put("factor",Constants.SDQ_FACTOR_TYPE_COMPANION);
								}else{
									mapQ.put("factor","Additional");
								}
							}

							postionlist.add(mapQ);

							if(postionlist.size()==9){
								System.out.println("111"+i);
							}

							if(postionlist.size() == 26){
								mapQ.put("type","Text");
								mapQ.put("answer","");
							}else{
								mapQ.put("type","Radio");
								mapQ.put("answer",list);
							}
							mapQ.put("id",postionlist.size());
						}

						if(!StringUtils.isEmpty(s) && postionlist.size() == 26){
							continue;
						}

						if(j==1 && !StringUtils.isEmpty(s)){
							mapQ.put("name",s);
						}
						if(j==2){
							map.put("id",s);
						}
						if(j==3){
							map.put("name",s);
						}
						if(j==4){
							map.put("score",s);
							list.add(map);
						}

					} // end for
					if(flag){
						break;
					}
				} // end for
			} // end for
		} // end while
		try{
			jedis.select(Constants.REDIS_DB_INDEX_EVALUATION);
			jedis.hset(Constants.FOLLOW_EVALUATION_PREGNANT_KEY,examinationPaperKey,JSON.toJSONString(postionlist));

			FuAssessMentPosition position = new FuAssessMentPosition();
			position.setId(SeqUtil.getSeqNo());
			position.setCreateAuthor("admin");
			position.setField(Constants.FOLLOW_EVALUATION_PREGNANT_KEY);
			position.setValue(JSON.toJSONString(postionlist));
			position.setKey(examinationPaperKey);
			position.setCreateTime(DateUtil.getSysDateA());
			position.setType(examinationPaperKey);
			followEvaluationDao.saveAssessMentPosition(position);
		}catch (JedisConnectionException jex) {
            logger.error("redis连接异常..." + jex.getMessage());
            throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_ERROR, "Redis缓存连接失败!"));
        } finally {
            if (null != jedis) {
                try {
                    jedis.close();
                    logger.warn("close redis connection...");
                } catch (Exception ex) {
                    ex.printStackTrace();
                    throw (new AppException(ErrorCode.FOLLOWUP_EXCEPTION_TYPE_REDIS_CONNECT_CLOSE_FAILED,
                            "Redis缓存关闭失败!"));
                }
            }
        }
//				System.out.println(JSON.parseObject(JSON.toJSONString(postionlist),LinkedHashMap.class));
		System.out.println(JSON.toJSONString(postionlist));
		in.close();
	}

}
